<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>javascript demo</title>
<link rel="stylesheet" href="css/base.css" />
</head>
<body>
<div class="wrap">
	<h2 class="wrap-h2">body后面添加一个script脚本！</h2>
	<div class="wrap-main"></div>
</div>
<script type="text/javascript">
	/*在 body 第一条 插入*/
	window.onload = function (){
		var newscr		= document.createElement("script");
		newscr.type 	= "text/javascript";
		newscr.async	= true;
		newscr.src		= "js/addscript.js";
		console.log(newscr);
		document.body.appendChild(newscr);
	}
	
	/*在 head 第一条 插入*/
	/*window.onload = function (){
		var linkid		= document.getElementsByTagName("link")[0];
		var newscr		= document.createElement("script");
		newscr.type 	= "text/javascript";
		newscr.async	= true;
		newscr.src		= "js/addscript.js";
		console.log(newscr);
		document.getElementsByTagName("head")[0].insertBefore(newscr,linkid);
	}*/
</script>
</body>
</html>
